home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmtset.cc < prev    next >
Encoding:
Text File  |  1994-09-06  |  1.1 KB  |  39 lines

  1. // CmTSet.cc
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // Set template implementation.
  7. // -----------------------------------------------------------------
  8.  
  9.  
  10. // "CmTSet" is the default set constructor.
  11. //
  12. template <class T> CmTSet<T>::CmTSet(unsigned sz)
  13.                             : CmTHashTable<T>(sz)
  14. {}
  15.  
  16.  
  17. // "CmTSet" is the set copy constructor.
  18. //
  19. template <class T> CmTSet<T>::CmTSet(const CmTSet<T>& S)
  20.                             : CmTHashTable<T>(S)
  21. {}
  22.  
  23.  
  24. // "=" assignment operator copies the specified set into this set.
  25. //
  26. template <class T> CmTSet<T>& CmTSet<T>::operator=(const CmTSet<T>& S)
  27. {
  28.   return (CmTSet<T>&) CmTHashTable<T>::operator=(S);
  29. }
  30.  
  31.  
  32. // "add" adds a new item to this set making sure not to duplicate an
  33. // existing item.
  34. //
  35. template <class T> Bool CmTSet<T>::add(const T& rObj)
  36. {
  37.   return (contains(rObj)) ? FALSE : CmTHashTable<T>::add(rObj);
  38. }
  39.